package wwy.Controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import wwy.Dao.BookshelfDao;
import wwy.Dto.BookDetailDto;
import wwy.Dto.BookShelfDto;
import wwy.Entity.Bookshelf;
import wwy.Service.BookDetailService;

import java.util.List;

@RestController
@Tag(name = "bookDetail", description = "书籍详细信息" )
@RequestMapping("/bookDetail")
public class BookDetailController extends LogicController<BookDetailService, BookshelfDao, Bookshelf,Long> {
    public BookDetailController(BookDetailService service) {super(service);}

    @GetMapping
    @Operation(summary = "获取书籍详细信息")
    public BookDetailDto getBookDetail(String bookName) {
        return service.getBookDetail(bookName);
    }
    @GetMapping("/getBookShelf")
    @Operation(summary = "获取书架信息")
    public List<BookShelfDto> getBookShelf() {
        return service.getBookShelf();
    }
    @PutMapping("/setBookProgress")
    @Operation(summary = "设置书籍阅读进度")
    public void setBookProgress(String bookName, Double progress) {
        service.setBookProgress(bookName, progress);
    }
}
